/*
 * ringbuffer.h
 *
 *  Created on: 2017年2月27日
 *      Author: baishaoqi
 */

#ifndef SRC_RINGBUFFER_H_
#define SRC_RINGBUFFER_H_

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

struct ursax_ringbuf;
typedef struct ursax_ringbuf ursax_ringbuf;

ursax_ringbuf * ursax_ringbuf_create (uint64_t ring_size, uint64_t alignment, void * ptr);

void * ursax_ringbuf_destroy (ursax_ringbuf * ring);

void * ursax_ringbuf_malloc (ursax_ringbuf * ring, uint64_t len);

void ursax_ringbuf_free(ursax_ringbuf * ring, void * buf);

uint64_t ursax_ringbuf_capacity(ursax_ringbuf *ring);

uint64_t ursax_ringbuf_used(ursax_ringbuf *ring);

#ifdef __cplusplus
}
#endif

#endif /* SRC_RINGBUFFER_H_ */
